package com.example.poemtest.index.dialog;

import android.app.Dialog;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.LinearLayout;

import androidx.databinding.DataBindingUtil;

import com.example.poemtest.R;
import com.example.poemtest.databinding.DialogChooseTextBinding;

/**
 * 飞花令的弹窗
 */
public class DialogChooseText extends Dialog {

    public DialogChooseText(Context context, int theme) {
        super(context, theme);
    }

    public static class Builder {private Context context;
        private DialogChooseTextBinding chooseTextBinding;

        public Builder(Context context) {
            this.context = context;
        }

        public DialogChooseTextBinding getChooseTextBinding() {
            return chooseTextBinding;
        }

        public void setChooseTextBinding(DialogChooseTextBinding chooseTextBinding) {
            this.chooseTextBinding = chooseTextBinding;
        }

        public DialogChooseText create() {
            LayoutInflater inflater = (LayoutInflater) context
                    .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
            final DialogChooseText dialog = new DialogChooseText(context, R.style.Dialog);
            View layout = inflater.inflate(R.layout.dialog_choose_text, null);
            chooseTextBinding = DataBindingUtil.bind(layout);
            dialog.addContentView(layout, new LinearLayout.LayoutParams(
                    android.view.ViewGroup.LayoutParams.WRAP_CONTENT
                    , android.view.ViewGroup.LayoutParams.WRAP_CONTENT));
            dialog.setContentView(layout);
            return dialog;
        }
    }
}